****
****
****	multi_study_graphs.do
****
****
****	Replication file for multistudy graphs for:
****		
****	"Intersectionality, Depression, and Voter Turnout"
****
****	by Christopher Ojeda and Christine Slaughter
****


**
** Figure 1
clear
set obs 20

gen dep_gap = .
replace dep_gap = 18.31 if _n == 1
replace dep_gap = 15.08 if _n == 2
replace dep_gap = 25.40 if _n == 3
replace dep_gap = 12.13 if _n == 4

replace dep_gap = -1.71 if _n == 5
replace dep_gap = 14.26 if _n == 6
replace dep_gap = 10.80 if _n == 7
replace dep_gap = 4.36 if _n == 8

replace dep_gap = 3.75 if _n == 9
replace dep_gap = 19.61 if _n == 10
replace dep_gap = -2.14 if _n == 11
replace dep_gap = 2.54 if _n == 12

replace dep_gap = 9.16 if _n == 13
replace dep_gap = 9.99 if _n == 14
replace dep_gap = 4.41 if _n == 15
replace dep_gap = 21.56 if _n == 16

replace dep_gap = 6.04 if _n == 17
replace dep_gap = 17.00 if _n == 18
replace dep_gap = 13.01 if _n == 19
replace dep_gap = 9.75 if _n == 20

gen dep_gap_str = "."
replace dep_gap_str = "18%" if _n == 1
replace dep_gap_str = "15%" if _n == 2
replace dep_gap_str = "25%" if _n == 3
replace dep_gap_str = "12%" if _n == 4

replace dep_gap_str = "-2%" if _n == 5
replace dep_gap_str = "14%" if _n == 6
replace dep_gap_str = "11%" if _n == 7
replace dep_gap_str = "4%" if _n == 8

replace dep_gap_str = "4%" if _n == 9
replace dep_gap_str = "20%" if _n == 10
replace dep_gap_str = "-2%" if _n == 11
replace dep_gap_str = "3%" if _n == 12

replace dep_gap_str = "9%" if _n == 13
replace dep_gap_str = "10%" if _n == 14
replace dep_gap_str = "4%" if _n == 15
replace dep_gap_str = "22%" if _n == 16

replace dep_gap_str = "6%" if _n == 17
replace dep_gap_str = "17%" if _n == 18
replace dep_gap_str = "13%" if _n == 19
replace dep_gap_str = "10%"s if _n == 20

forvalues i=1(1)20{
gen dep_gap`i' = .
replace dep_gap`i' = dep_gap if _n == `i'
}
*

gen n_var = .
replace n_var = 1 if _n == 1
replace n_var = 2 if _n == 5
replace n_var = 3 if _n == 9
replace n_var = 4 if _n == 13
replace n_var = 5 if _n == 17

replace n_var = 7 if _n == 2
replace n_var = 8 if _n == 6
replace n_var = 9 if _n == 10
replace n_var = 10 if _n == 14
replace n_var = 11 if _n == 18

replace n_var = 13 if _n == 3
replace n_var = 14 if _n == 7
replace n_var = 15 if _n == 11
replace n_var = 16 if _n == 15
replace n_var = 17 if _n == 19

replace n_var = 19 if _n == 4
replace n_var = 20 if _n == 8
replace n_var = 21 if _n == 12
replace n_var = 22 if _n == 16
replace n_var = 23 if _n == 20

gen dep_gap_n = dep_gap
replace dep_gap_n = 0 if dep_gap < 0

twoway(bar dep_gap1 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("247 247 247")) ///
		(bar dep_gap2 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("247 247 247")) ///
		(bar dep_gap3 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("247 247 247")) ///
		(bar dep_gap4 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("247 247 247")) ///
		(bar dep_gap5 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("204 204 204")) ///
		(bar dep_gap6 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("204 204 204")) ///
		(bar dep_gap7 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("204 204 204")) ///
		(bar dep_gap8 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("204 204 204")) ///
		(bar dep_gap9 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("150 150 150")) ///
		(bar dep_gap10 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("150 150 150")) ///
		(bar dep_gap11 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("150 150 150")) ///
		(bar dep_gap12 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("150 150 150")) ///
		(bar dep_gap13 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("82 82 82")) ///
		(bar dep_gap14 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("82 82 82")) ///
		(bar dep_gap15 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("82 82 82")) ///
		(bar dep_gap16 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor("82 82 82")) ///
		(bar dep_gap17 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor(black)) ///
		(bar dep_gap18 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor(black)) ///
		(bar dep_gap19 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor(black)) ///
		(bar dep_gap20 n_var, barwidth(0.75) lcolor(black) lwidth(thin) fcolor(black)) ///
		(scatter dep_gap_n n_var, msymbol(i) mlabel(dep_gap_str) mlabposition(12) mlabsize(2.5) mcolor(black)), ///
		legend(order(1 5 9 13 17) label(1 "PSID" "(2004)") label(5 "PSID" "(2006)") label(9 "PSID" "(2008)") label(13 "PSID" "(2010)") label(17 "Add" "Health") row(1) symxsize(5) size(small)) ///
		ylabel(0 5 10 15 20 25 30, labsize(2.5) angle(horizontal) nogrid) ///
		xlabel(3 `""White" "Men""' 9 `""White" "Women""' 15 `""Black" "Men""' 21 `""Black" "Women""', notick labgap(2)) ///
		xtitle("") ///
		ytitle("Depression-Participation Gap") ///
		scheme(s1mono) graphregion(fcolor(white))

		
**
** Figure 2
coefplot(matrix(psid_gap1[.,1]), se(psid_gap1[.,2]) m(O) msize(med) mfcolor(white) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(add_gap1[.,1]), se(add_gap1[.,2]) offset(-.2) m(O) msize(med) mfcolor(black) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(psid_gap2[.,1]), se(psid_gap2[.,2]) m(O) msize(med) mfcolor(white) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(add_gap2[.,1]), se(add_gap2[.,2]) offset(-.2) m(O) msize(med) mfcolor(black) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(psid_gap3[.,1]), se(psid_gap3[.,2]) m(O) msize(med) mfcolor(white) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(add_gap3[.,1]), se(add_gap3[.,2]) offset(-.2) m(O) msize(med) mfcolor(black) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(psid_gap4[.,1]), se(psid_gap4[.,2]) m(O) msize(med) mfcolor(white) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(add_gap4[.,1]), se(add_gap4[.,2]) offset(-.2) m(O) msize(med) mfcolor(black) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(psid_gap5[.,1]), se(psid_gap5[.,2]) m(O) msize(med) mfcolor(white) mlc(black) ciop(lcolor(gs12) lwidth(medthick))) ///
		(matrix(add_gap5[.,1]), se(add_gap5[.,2]) offset(-.2) m(O) msize(med) mfcolor(black) mlc(black) ciop(lcolor(gs12) lwidth(medthick))), ///
		level(95) ///
		legend(order(2 4) label(2 "PSID") label(4 "Add Health") region(style(none)) position(1) ring(0) row(2) symxsize(5)) ///
		xline(0, lpattern(dash) lcolor(gs10)) ///
		coeflabels(, notick labsize(4)) ///
		xtitle("Estimated Coefficient for Depressive Symptoms", size(4)) ///
		xlabel(-.8 -.6 -.4 -.2 0 .2 .4 .6 .8, labsize(2.5)) ///
		yscale(noline titlegap(4)) ///
		xscale(titlegap(4)) ///
		grid(n) ///
		plotregion(style(none)) /// 
		scheme(s1mono)
				
	

	
	
	
